package com.tgy.JUC.FunctionInterface;

import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;

/***
 * @ClassName: demo1
 * @Description:
 * @Auther: 送你一块二向箔
 * @Date: 15:35 2022/3/14
 * @version : V1.0
 */
public class Demo1 {
    public static void main(String[] args) {
        run1();
        run2();
        run3();
        run4();
    }

    public static void run1(){
        Function<String,String> function = (str)->{return str+"你好";};
        System.out.println(function.apply("紫薇"));
    }
    public static void run2(){
        Predicate<Integer> predicate = (num)->{return num>0?true:false;};
        System.out.println(predicate.test(3));

    }
    public static void run3(){
        Consumer<Integer> consumer = (num)->{
            System.out.println("数字"+num);
        };
        consumer.accept(5);
        int[] aaa = new int[4];
        String[] list = {"1","1","1","1","1",};
        List<String> strings = Arrays.asList(list);
        strings.forEach(System.out::println);

    }
    public static void run4(){
        Supplier supplier = ()->{return "666";};
        System.out.println(supplier.get());
    }
}
